import Vue from 'vue';
import App from '@/App.vue';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import i18n from '@/i18n';
import store from '@/store';
import router from '@/router';

import VueCookies from 'vue-cookies';
import Fingerprint2 from 'fingerprintjs2';

import '@/assets/iconfont/iconfont.css';//图标库

Vue.use(ElementUI);
Vue.use(VueCookies);

Vue.config.productionTip = false;//阻止显示生产模式的消息

//生成浏览器唯一标识
Fingerprint2.get(function(components) {
  const values = components.map(function(component,index) {
    if (index === 0) { //把微信浏览器里UA的wifi或4G等网络替换成空,不然切换网络会ID不一样
      return component.value.replace(/\bNetType\/\w+\b/, '')
    }
    return component.value
  });
  // 生成最终id
  const clientUUID = Fingerprint2.x64hash128(values.join(''), 31);
  localStorage.setItem('chhuangboot.clientUUID', clientUUID);
});

new Vue({
  i18n,
  store,
  router,
  render: h => h(App),
}).$mount('#app')
